load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("//build:STRINGER.bzl", "stringer")

go_library(
    name = "base",
    srcs = [
        "addr_validation.go",
        "cluster_id.go",
        "config.go",
        "constants.go",
        "license.go",
        "node_id.go",
        "store_spec.go",
        "test_cluster_replication_mode.go",
        "test_server_args.go",
        "testing_knobs.go",
        "zone.go",
        ":gen-clusterreplication-stringer",  # keep
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/base",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/cli/cliflags",
        "//pkg/roachpb",
        "//pkg/security/username",
        "//pkg/settings/cluster",
        "//pkg/testutils/listenerutil",
        "//pkg/util",
        "//pkg/util/envutil",
        "//pkg/util/humanizeutil",
        "//pkg/util/metric",
        "//pkg/util/mon",
        "//pkg/util/netutil/addr",
        "//pkg/util/retry",
        "//pkg/util/stop",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_errors//oserror",
        "@com_github_cockroachdb_pebble//:pebble",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_dustin_go_humanize//:go-humanize",
        "@com_github_spf13_pflag//:pflag",
    ],
)

go_test(
    name = "base_test",
    size = "small",
    srcs = [
        "addr_validation_test.go",
        "cluster_id_test.go",
        "config_test.go",
        "main_test.go",
        "node_id_test.go",
        "store_spec_test.go",
        "test_server_args_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":base"],
    deps = [
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/testutils",
        "//pkg/testutils/datapathutils",
        "//pkg/testutils/echotest",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_davecgh_go_spew//spew",
        "@com_github_stretchr_testify//require",
    ],
)

stringer(
    name = "gen-clusterreplication-stringer",
    src = "test_cluster_replication_mode.go",
    typ = "TestClusterReplicationMode",
)
